﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIFly : MonoBehaviour
{
    public GameObject btnUp, btnDown, btnLeft, btnRight;
    public Text time, hight, money;
    public Slider Slider1, Slider2, Slider3, SliderHight;
    // Start is called before the first frame update
    void Start()
    {
        btnUp = transform.Find("Controller/up").gameObject;
        btnDown = transform.Find("Controller/down").gameObject;
        btnLeft = transform.Find("Controller/left").gameObject;
        btnRight = transform.Find("Controller/right").gameObject;
        UGUIEventListener.Get(btnUp).onDown = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().up = true;
        };
        UGUIEventListener.Get(btnUp).onUp = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().up = false;
        };
        UGUIEventListener.Get(btnDown).onDown = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().down = true;
        };
        UGUIEventListener.Get(btnDown).onUp = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().down = false;
        };
        UGUIEventListener.Get(btnLeft).onDown = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().left = true;
        };
        UGUIEventListener.Get(btnLeft).onUp = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().left = false;
        };
        UGUIEventListener.Get(btnRight).onDown = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().right = true;
        };
        UGUIEventListener.Get(btnRight).onUp = (go, data) =>
        {
            GameController.instance.rocket.GetComponent<rocket>().right = false;
        };
    }

    // Update is called once per frame
    void Update()
    {

    }
}
